package com.fansaikj.erp.domain.comtactCompany;/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import com.fansaikj.erp.domain.InvoiceTaxRate;
import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Filter;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(
        name = "供应商管理",
        filter = @Filter("SupplierCompany.companyType='2'"),
        power = @Power(add = true, delete = true,
                edit = true, query = true, viewDetails = true,
                importable = true, export = true)
)
@Table(name = "erp_contact_company")
@Entity
@Data
public class SupplierCompany extends BaseModel {

    @EruptField(
            views = @View(
                    title = "主键ID", show = false
            ),
            edit = @Edit(
                    title = "主键ID",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @EruptField(
            views = @View(
                    title = "单位类型",
                    width = "80px"
            ),
            edit = @Edit(
                    title = "单位类型",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(value = "1", label = "客户"),
                                    @VL(value = "2", label = "供应商"),
                                    @VL(value = "3", label = "物流公司"),
                                    @VL(value = "4", label = "其他单位"),
                            }
                    )
            )
    )
    private String companyType;

    @EruptField(
            views = @View(
                    width = "200px",
                    title = "单位名称"
            ),
            edit = @Edit(
                    title = "单位名称",
                    search = @Search(vague = true),
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String name;

    @ManyToOne
    @EruptField(
            views = @View(
                    width = "80px",
                    title = "销售类型",
                    column = "invoiceType"
            ),
            edit = @Edit(
                    title = "销售类型",
                    search = @Search,
                    type = EditType.REFERENCE_TABLE,
                    referenceTableType = @ReferenceTableType(
                            id = "id",
                            label = "invoiceType"
                    )
            )
    )
    private InvoiceTaxRate taxRate;

    @EruptField(
            views = @View(
                    title = "业务员"
            ),
            edit = @Edit(
                    title = "业务员",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String owner;

    @EruptField(
            views = @View(
                    title = "单位状态"
            ),
            edit = @Edit(
                    title = "单位状态",
                    search = @Search,
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(value = "0", label = "正常"),
                                    @VL(value = "1", label = "禁用")
                            }
                    )
            )
    )
    private String companyStatus;

    @EruptField(
            views = @View(
                    title = "纳税人识别号"
            ),
            edit = @Edit(
                    title = "纳税人识别号",
                    search = @Search(vague = true),
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String creditNo;

    @EruptField(
            views = @View(
                    title = "注册地址"
            ),
            edit = @Edit(
                    title = "注册地址",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String addrDetail;

    @EruptField(
            views = @View(
                    title = "注册电话"
            ),
            edit = @Edit(
                    title = "注册电话",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String phone;

    @EruptField(
            views = @View(
                    title = "开户银行"
            ),
            edit = @Edit(
                    title = "开户银行",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String openBank;

    @EruptField(
            views = @View(
                    title = "银行账号"
            ),
            edit = @Edit(
                    title = "银行账号",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String bankAccount;

    @EruptField(
            views = @View(
                    title = "开户行号"
            ),
            edit = @Edit(
                    title = "开户行号",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String bankCode;

    @EruptField(
            views = @View(
                    title = "收件邮箱"
            ),
            edit = @Edit(
                    title = "收件邮箱",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String recipientEmail;

    @EruptField(
            views = @View(
                    title = "支出运费名称"
            ),
            edit = @Edit(
                    title = "支出运费名称",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String freightName;

    @EruptField(
            views = @View(
                    title = "最后交易日期"
            ),
            edit = @Edit(
                    title = "最后交易日期",
                    type = EditType.DATE,
                    dateType = @DateType
            )
    )
    private Date lastTradeTime;

    @EruptField(
            views = @View(
                    title = "单位省市区"
            ),
            edit = @Edit(
                    title = "单位省市区",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String addrProvincesCity;

    @EruptField(
            views = @View(
                    title = "收件人"
            ),
            edit = @Edit(
                    title = "收件人",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String recipient;

    @EruptField(
            views = @View(
                    title = "收件人地址"
            ),
            edit = @Edit(
                    title = "收件人地址",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String recipientAddr;

    @EruptField(
            views = @View(
                    title = "创建人", show = false
            ),
            edit = @Edit(
                    title = "创建人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建时间", show = false
            ),
            edit = @Edit(
                    title = "创建时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "修改人", show = false
            ),
            edit = @Edit(
                    title = "修改人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "修改时间", show = false
            ),
            edit = @Edit(
                    title = "修改时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "备注"
            ),
            edit = @Edit(
                    title = "备注",
                    type = EditType.TEXTAREA
            )
    )
    private String remark;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}